<!DOCTYPE html>
<html>
<head>
    <title>Register</title>
    <meta charset="utf-8">
    <link href="/static/css/style.css" rel='stylesheet' type='text/css' />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script type="text/javascript" src="/static/js/jquery-2.2.2.js"></script>
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
    <script type="text/javascript">
        function checkPassword(){
            var password = document.getElementsByName("password")[0].value;
            var password2 =document.getElementsByName("password2")[0].value;
            if(password!=password2){
                document.getElementById("password-error").innerHTML="两次密码不一致";
            }else{
                document.getElementById("password-error").innerHTML="";
            }

        }
        function checkUsername(){
            var username = $('#username').val();
            if(null==username||""==username){
                alert("用户名不能为空！");
            }
            else {
                $.ajax({
                    type: "post",
                    url: "/isExist",
                    data: "username=" + username,
                    dataType: "json",
                    complete: function (msg) {
                        var result = eval("(" + msg.responseText + ")");
                        document.getElementById("nameError").innerHTML = result.message;

                    }
                })
            }
        }
    </script>
    <style type="text/css">
        .main{
            height: 600px;
        }
        .head{
            top: -17%;
            margin-left: 5%;
        }
        .head img{
            width: 150%;
        }
        .main h1{
            padding-top: 5%;
            padding-bottom: 3%;
        }
        input[type="text"], input[type="password"]{
            width:  190px;
            height: 25px;
            padding: 1px 1px 1px 1px;
            font-size: 12px;
            font-weight: 300;
            margin-bottom: 2%;
            float: left;
        }
         .me{
             position: relative;
            font-size:20px;
            color:#676767;
            font-family: 'Open Sans', sans-serif;
             width: 250px;
             text-align: right;
             float: left;
        }
         .te{
             position: relative;
             float: left;
             width: 200px;
             height: 30px;
             margin-left: 5px;


         }
        .error{
            position: relative;
            font-size:14px;
            color:red;
            font-family: 'Open Sans', sans-serif;
            font-weight:500;
            text-align: center;
            width: 150px;
            height: 29px;
            float: left;
            margin-left: 5px;
            padding-top: 4px;
        }
        .group{
            height: 30px;
            width:640px;
            position: relative;
            padding: 2px 2px 2px 2px;
            margin-top: 5px;
        }
        input[type="submit"]{
            width: 20%;
            padding: 1%;
            margin-top: 2%;
            margin-bottom: 3%;
            float: right;
        }

    </style>
</head>
<body>
<div class="main">
    <div class="register-form">
        <form action="/register" method="post" >
            <div class="head">
                <img src="/static/images/user.png" alt=""/>
            </div>
            <h1>Member register</h1>
            <div class="group">
                <div class="me">用户名:</div>
                <input type="text" name="username" id="username" class="te" onblur="checkUsername()">
                <div class="error" id="nameError"></div>
            </div>
            <div class="group">
                <div class="me">密码: </div>
                <input type="password" name="password" onblur="checkPassword()" class="te" >
                <div class="error"></div>
            </div>
            <div class="group">
                <div class="me">再次输入密码: </div>
                <input type="password" name="password2" onblur="checkPassword()" class="te">
                <div class="error" id="password-error"></div>
            </div>
            <div class="group">
                <div class="me">年龄:</div>
                <input type="text" name="age"  class="te">
                <div class="error"></div>
            </div>
            <div class="group">
                <div class="me">车牌号:</div>
                <input type="text" name="plate"  class="te">
                <div class="error"></div>
            </div>
            <div class="group">
                <div class="me">电话号码:</div>
                <input type="text" name="phoneNumber"  class="te">
                <div class="error"></div>
            </div>
                <div class="group">
                <input type="submit"  value="register" >
                </div>
        </form>
    </div>
</div>

<div style="display:none"><script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script></div>
</body>
</html>